import './index.less'
import {useCanvasByContext} from "@/utils/canvasHook";
import React, {useState} from "react";
import EditCmp from "@/views/dataScreen/components/EditCmp";
import EditCanvas from '../../components/EditCanvas';

const RigBox = () => {
    const canvas: any = useCanvasByContext();
    const selectedCmp = canvas.getSelectedCmp();

    const [showEdit, setShowEdit] = useState(true);
    // @ts-ignore
    return (<div className={'right-box-main'}>
        <div
            className={'switch'}
            onClick={() => {
                setShowEdit(!showEdit);
            }}>
            {showEdit ? "隐藏编辑区域" : "显示编辑区域"}
        </div>
        {showEdit && (selectedCmp ? <EditCmp/> : <EditCanvas/>)}
    </div>)
}
export default RigBox
